import { baseUrlApi, requestClient, type Result } from '#/api/request';

/** 获取列表 */
export const getArticleAttributes = (params?: object) => {
  return requestClient.get<Result>(
    baseUrlApi('/portal/admin/article_attributes'),
    {
      params,
    },
  );
};

/** 添加 */
export const postArticleAttributes = (data?: object) => {
  return requestClient.post<Result>(
    baseUrlApi('/portal/admin/article_attributes'),
    data,
  );
};

/** 获取信息 */
export const getArticleAttributesInfo = (data: { id: number }) => {
  return requestClient.get<Result>(
    baseUrlApi(`/portal/admin/article_attributes/${data.id}`),
  );
};

/** 编辑 */
export const putArticleAttributes = (id: number, data?: any) => {
  return requestClient.put<Result>(
    baseUrlApi(`/portal/admin/article_attributes/${id}`),
    data,
  );
};

/** 删除 */
export const deleteArticleAttributes = (id?: number) => {
  return requestClient.delete<Result>(
    baseUrlApi(`/portal/admin/article_attributes/${id}`),
  );
};

/** 设置状态 */
export const postArticleAttributesStatus = (data: { id: number }) => {
  return requestClient.post<Result>(
    baseUrlApi(`/portal/admin/article_attributes/${data.id}/status`),
    data,
  );
};

/** 后台菜单排序 */
export const postArticleAttributesListOrder = (data?: {
  list_orders: object;
}) => {
  return requestClient.post<Result>(
    baseUrlApi('/portal/admin/article_attributes/list/order'),
    data,
  );
};
